""" 
超声波模块HCSR04 , 读取距离
接线:
    Trig --> GPIO4
    Echo --> GPIO27

"""
from machine import Pin
import time
from hcsr04 import HCSR04

hcsr04 = HCSR04(trigger_pin=4, echo_pin=27)

if __name__ == "__main__":
    while True:
        distance = hcsr04.distance_cm()
        print("distance=%.2f cm"%(distance))
        time.sleep(1)